From 3126aaf21e69b3c3d1006d295e2c981868d19e03 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Fri, 11 Aug 2006 09:26:03 +0000 Subject: [PATCH] (bindat-ip-to-string): Use `format-network-address' if possible. --- lisp/emacs-lisp/bindat.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el index d05eed2c4a2..1b37f3f772f 100644 --- a/lisp/emacs-lisp/bindat.el +++ b/lisp/emacs-lisp/bindat.el @@ -619,9 +619,12 @@ If optional second arg SEP is a string, use that as separator." (bindat-format-vector vect "%02x" (if (stringp sep) sep ":"))) (defun bindat-ip-to-string (ip) - "Format vector IP as an ip address in dotted notation." - (format "%d.%d.%d.%d" - (aref ip 0) (aref ip 1) (aref ip 2) (aref ip 3))) + "Format vector IP as an ip address in dotted notation. +The port (if any) is omitted. IP can be a string, as well." + (if (vectorp ip) + (format-network-address ip t) + (format "%d.%d.%d.%d" + (aref ip 0) (aref ip 1) (aref ip 2) (aref ip 3)))) (provide 'bindat) -- 2.30.2